<!-- 销售管理->面积计算表 -->
<template>
    <div class="content-wrapper a-base-container">
        <div class="requisition-set-wrapper">
            <!-- 按钮 -->
            <div class="btn-wrapper clearfix">

                <btns-wrapper @searchClick="searchClick" :showModel="showModel" :orderId="orderId" :voucherState="voucherState" :editMask="editMask" @printOrder="printOrder" @switchList="switchList" @submitServer="submitServer" @clickEdit="clickEdit" @deleteOrder="deleteOrder" @getIdByData="getIdByData" @auditClick="auditClick" @turnThePage="turnThePage" @syncOrder="syncOrder" @submitOrder="submitOrder" @exportDetail="exportDetail" @priceShow="priceShow" :sourceCode="sourceCode">
                    <template slot="neworder">
                        <a-dropdown class="btns" key="new" style="display:block">
                            <a class="ant-dropdown-link" @click="e => e.preventDefault()">
                                <a-icon class="btns-icon" type="file-add" />
                                <div class="btns-text">新增
                                    <a-icon type="down" style="color:rgb(24,144,255);vertical-align:middle;" />
                                </div>
                            </a>
                            <a-menu slot="overlay">
                                <a-menu-item key="0">
                                    <a href="javascript:void(0)" @click="newForecast">新增</a>
                                </a-menu-item>
                            </a-menu>
                        </a-dropdown>
                    </template>
                    <template slot="moreBtn">
                        <a-col class="btn-item" :class="!orderId ?'':'btns-disable'">
                            <div v-if="showModel=='order'">
                                <div class="btns" @click="!orderId?importData():''">
                                    <a-icon class="btns-icon" type="import" />
                                    <div class="btns-text">导入</div>
                                </div>
                            </div>
                            <div v-else class="btns-disable">
                                <div class="btns">
                                    <a-icon class="btns-icon" type="import" />
                                    <div class="btns-text">导入</div>
                                </div>
                            </div>
                        </a-col>
                        <a-col class="btn-item" :class="orderId ?'':'btns-disable'">
                            <div v-if="showModel=='order'">
                                <div class="btns" @click="orderId?exportData():''">
                                    <a-icon class="btns-icon" type="export" />
                                    <div class="btns-text">导出</div>
                                </div>
                            </div>
                            <div v-else class="btns-disable">
                                <div class="btns">
                                    <a-icon class="btns-icon" type="export" />
                                    <div class="btns-text">导出</div>
                                </div>
                            </div>
                        </a-col>
                        <a-col class="btn-item" :class="orderId ?'':'btns-disable'">
                            <div v-if="showModel=='order'">
                                <div class="btns" @click="orderId?generateByline():''">
                                    <a-icon class="btns-icon" type="printer" />
                                    <div class="btns-text">条码打印</div>
                                </div>
                            </div>
                            <div v-else class="btns-disable">
                                <div class="btns">
                                    <a-icon class="btns-icon" type="printer" />
                                    <div class="btns-text">条码打印</div>
                                </div>
                            </div>
                        </a-col>
                    </template>
                    <!-- <template slot="shengdan">
                        <a-dropdown class="btns" key="sheng" style="display:block">
                            <a class="ant-dropdown-link" @click="e => e.preventDefault()">
                                <a-icon class="btns-icon" type="snippets" />
                                <div class="btns-text">生单
                                    <a-icon type="down" />
                                </div>
                            </a>
                            <a-menu v-if="voucherState==1" slot="overlay">
                                <a-menu-item key="0">
                                    <a href="javascript:void(0)" @click="generateBills('SaleDelivery')">生成销售发货单</a>
                                </a-menu-item>
                            </a-menu>
                        </a-dropdown>
                    </template> -->
                </btns-wrapper>

            </div>
            <div ref="print" class="documents-wrapper" id="documents-wrapper">
                <h3 class="text-center">
                    {{voucherTitle}}
                </h3>
                <section v-show="showModel=='list'">
                    <!--列表-->
                    <dynamicList ref="dyList" :basePostData="basePostData" :sourceCode="sourceCode" @switchList="switchList" @dblclick="getIdByData" :reportCode="reportCodeList"></dynamicList>
                </section>
                <section v-show="showModel=='order'">
                    <div><span class="audit-status" v-show="voucherState==0">待审核</span><span class="audit-status" v-show="voucherState==1 || voucherState==10">{{voucherState==1?'已审核':'关闭'}}</span></div>
                    <a-form-model :layout="formLayout">
                        <div class="header-box">
                            <order-dynamic-form :FormData="orderHeaderData" @changetime="onChangeTime" @clickItem="setValue"></order-dynamic-form>
                            <div class="edit-mask-header" v-show="editMask">
                                <!-- 遮罩（点击修改关闭遮罩） -->
                            </div>
                        </div>
                        <div class="table-box margin-top-20">
                            <!-- <a-table v-show="false" id="bills_tb" :columns="columns" :data-source="dataSource" :customRow="customClick" :scroll="{ x: 1000, y: 347 }" :pagination="false" @change="onTableChange" :size="small" bordered>
                                <template v-if="isRouterAlive" slot="number" slot-scope="text, record, index">
                                    <div v-if="index == dataSource.length-1">
                                        合计
                                    </div>
                                    <div v-else>
                                        {{index+1}}
                                    </div>
                                </template>
                                <template v-for="col in slotArray" :slot="col" slot-scope="text, record,index">
                                    <div data-key="">
                                        <editable-cell v-if="isRouterAlive" :checkType="checkType" :text="text" :col="col" :index="index" :record="record" :dataSource="dataSource" :unitsDataDetails="unitsDataDetails" :unitsAssistSelect="unitsAssistSelect" :dynamicAllData="dynamicFormData" :dynamicFormDataMap="dynamicFormDataMap"  @choiceAddData="choiceAddData(index,col,$event)" @change="onCellChange(index, col, $event)" @newAddData="handleAdd" />
                                    </div>
                                </template>
                            </a-table> -->
                            <div class="edit-mask" style="width:calc(100% - 70px);left:57px;" v-show="editMask">
                                <!-- 遮罩（点击修改关闭遮罩） -->
                            </div>
                            <a-button size="small" @click="insertEvent(-1)" class="margin-bottom-5">添加行</a-button>
                            <ux-grid style="width: 100%" class="ux-table" cellStyle="height:36px;" row-key="id" use-virtual :big-data-checkbox="true" border :sum-text="合计" show-summary :summaryMethod="summaryMethod" show-body-overflow ref="plxTable" @select-all="selectAll" @select="selectTable" keep-source height="500" :edit-config="{trigger: 'click', mode: 'cell'}">
                                <ux-table-column type="checkbox" width="60" align="center"></ux-table-column>

                                <ux-table-column :field="item.key" :label="item.title" v-for="(item,index) in columns" :filters="item.dataIndex == 'no'?[{ data: '' }]:''" :filter-method="item.dataIndex == 'no'?filterAgeMethod:''" :key="item.id" :title="item.title" :width="item.width" :min-width="item.key == 'number'?30:80" height="32" :editRender="!notEdit.includes(item.key)?true:false">
                                    <template v-if="item.key != 'number'" v-slot:edit="scope">
                                        <a-input v-model="scope.row[item.key]" @input="updateFooterEvent(scope.row[item.key])" />
                                        </a-input>
                                    </template>
                                    <!--自定义筛选模板-->
                                    <template v-if="item.dataIndex == 'no'" v-slot:filter="{ $panel, column }">
                                        <!--column.filters就是去渲染的这个东西:filters="[{ data: '' }]，然后v-model绑定到了这个data属性啦-->
                                        <a-input type="type" v-for="(option, index) in column.filters" :key="option" v-model="option.data" @input="$panel.changeOption($event, option.data, option)" />
                                        </a-input>
                                    </template>
                                </ux-table-column>
                            </ux-grid>
                        </div>
                        <div class="footer-box">
                            <order-dynamic-form :FormData="orderFooterData"  @changetime="onChangeTime" @clickItem="setValue"></order-dynamic-form>
                            <div class="edit-mask-footer" v-show="editMask">
                                <!-- 遮罩（点击修改关闭遮罩） -->
                            </div>
                        </div>
                    </a-form-model>
                </section>
                <section v-show="showModel=='detail'">
                    <!--明细-->
                    <dynamicListDetails ref="detailSearchRef" :reportCode="reportCodeDetail" :componentType="1" :basePostData="basePostData"></dynamicListDetails>
                </section>
                <section v-show="showModel=='statistical'">
                    <!--统计-->
                    <dynamicListDetails ref="statisticalSearchRef" :reportCode="reportCodeStatistical" :componentType="2" :basePostData="basePostData"></dynamicListDetails>
                </section>
            </div>
            <div class="contextmenu-box">
                <!-- 右键菜单 -->
                <ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
                    <li @click="handleAdd()">新增行</li>
                    <li @click="handleDelete()">删除行</li>
                    <!-- <li @click="handleCopy()">复制行</li> -->
                </ul>
            </div>
            <drawerBox ref="searchList" :unitData="unitData" :unitsData="unitsData" :unitsDataDetails="unitsDataDetails" @editClickOrder="editClickOrder"></drawerBox>
        </div>

        <!--加载中-->
        <div class="loading-wrapper" v-show="loading">
            <a-spin v-if="saveLoding" class="loading-content" tip="保存中..." />
            <a-spin v-else class="loading-content" tip="加载中..." />
        </div>
        <!--用做横向打印-->
        <!-- <div v-html="stylePrint"></div> -->
        <print-modal ref="printDom" v-if="printVisible" :incomingPrintData="incomingPrintData" @cancelPrint="cancelPrint"></print-modal>

        <importAndExport ref="importAreaRef" @syncFun="syncFun" @backArea="backArea"></importAndExport>
        <a-modal :visible="priceModal" title="报价" @cancel="closePrice" :width="1000">
            <ux-grid style="width: 100%" class="ux-table" cellStyle="height:36px;" border show-body-overflow ref="priceTable" keep-source height="500" :edit-config="{trigger: 'click', mode: 'cell'}">
                <ux-table-column :field="item.key" :label="item.title" v-for="(item,index) in columnsPrice" :key="index" :title="item.title" :width="item.width" :min-width="item.key == 'number'?30:80" height="32" :editRender="item.key == 'price' ?true:false">
                    <template v-if="item.key == 'price'" v-slot:edit="scope">
                        <a-input onkeyup="value=value.toString().match(/^\d+(?:\.\d{0,2})?/)" v-model.trim="scope.row[item.key]"></a-input>
                    </template>
                </ux-table-column>
            </ux-grid>
            <template slot="footer">
                <div>
                    <a-button type="primary" @click="okPirce">确认</a-button>
                    <a-button @click="closePrice" class="margin-left-10">关闭</a-button>
                </div>
            </template>
        </a-modal>

        <a-modal title="条码生成列表" :visible="printDetailsModal" :width="1000" @cancel="hideDetails">
            <div style="margin:35px auto;">
                <div style="margin-bottom:10px;">
                    <a-button size="small" @click="printPreviewLodop">条码打印</a-button>
                </div>
                <a-table style="min-height:400px;" :columns="columnsPrint" :data-source="dataSourceShowDetails" :row-selection="{ selectedRowKeys: selectedAgainKeys, onChange: onSelectAgainChange}" :pagination="false" bordered :scroll="{x:800,y:420}">

                </a-table>
            </div>
            <template slot="footer">
                <a-button type="primary" @click="hideDetails">关闭</a-button>
            </template>
        </a-modal>

        <!-- <div v-show="saveLoding" class="save-class" style="position:fixed;width:100%;height:100%;background:rgba(0,0,0,0.5);top:0;left:0;right:0;z-index:100">
            <a-spin tip="保存中..." style="position:absolute;top:50%;left:50%;color:#fff;">

            </a-spin>
        </div> -->
    </div>
</template>
<script>


import { save, examine, remove, getCode, exportAreaData, setPrice, getInOutRecord } from '@/api/sale/areaCalculation'


import pro from '@/mixins/procurement/pro';
import importAndExport from "@/components/ImportAndExport/index"
import { getLodop } from "@/utils/tool/LodopFun"
import { listRule, listTemplate, getVoucherDesign, generateTheBarcode, barcodeDetail, pageList, getCodeListDetails } from "@/api/inventory/barcode";
export default {
    mixins: [pro],
    components: {
        importAndExport
    },
    data () {
        return {
            //基础 查询条件（列表 + 翻页）
            basePostData: {
                someBusinessType: null,
            },
            financeType: true,
            sourceCode: 'AreaCalculation',
            reportCodeDetail: 'AreaCalculation_Detail_Report',          //明细code
            reportCodeStatistical: 'AreaCalculation_Statistic_Report',   //统计code
            reportCodeList: 'AreaCalculation_List_Report',              //列表code
            checkType: 'is_for_sale',//销售

            tableData: [],
            totalOptions: [
                { label: '数量', unit: '元' },
                { label: '长', unit: '个' }
            ],
            priceModal: false,
            dataSourcePrice: [],

            notEdit: ['inNum', 'outNum', 'number', 'price', 'amount'],//不能编辑的字段
            isAreaX: true,//是否是新西亚项目
            selectionRow: [],//需要打印的数据
            printDetailsModal: false,

            columnsPrint: [{
                title: '序号', dataIndex: 'number', width: 30, align: 'center',
                customRender: (text, record, index) => {
                    return index + 1;
                }
            }, {
                title: '条码', dataIndex: 'barCode', width: 140,
            }, {
                title: '编号', dataIndex: 'no', width: 140,
            }, {
                title: '数量', dataIndex: 'quantity', width: 80, customRender: (text, record, index) => {
                    return `${record.sort}/${text}`
                },
            }, {
                title: '项目编码', dataIndex: 'projectCode', width: 100,
            },
                // {
                //     title: '打印数量', dataIndex: 'printQuantity', width: 60,
                // }, {
                //     title: '累积打印次数', dataIndex: 'cumPrintQuantity', width: 100,
                // },
            ],
            dataSourceShowDetails: [],//需要打印的条码数组
            selectedAgainKeys: [],
            selectedAgainRows: [],
            saveLoding: false,
            dataSourceNumber: 11,    //明细table初始多少条
            totalYes: ['quantity', 'unitArea', 'totalArea'],//需要合计的字段
        };
    },
    created () {
        //this.getIdByData();//获取最新一条数据
    },
    mounted () {
        // 延迟加载
        setTimeout(() => {
            console.log(this.columns)
            // this.columns = Array.from({ length: 200 }, (_, idx) => ({
            //     prop: 'name',
            //     id: idx,
            //     label: '名字' + idx,
            //     width: 200,
            //     sortable: idx === 1,
            //     resizable: true
            // }))

            // this.tableData = Array.from({ length: 500 }, (_, idx) => ({
            //     id: idx + 1,
            //     date: '2016-05-03',
            //     name: '张三' + idx,
            //     sex: 1,
            //     age: 18 + idx,
            //     time: '9:10',
            //     address: ['zhinan', 'shejiyuanze', 'kekong'],
            //     single: idx < 2
            // }))
            // console.log('this.tableData:', this.tableData);
            // console.log('this.dataSource:', this.dataSource);

            // col.forEach((item, index) => {
            //     if (item.key == 'number') {
            //         col.splice(index, 1);
            //     }
            // });



            // 这样设置大量数据的表格
            this.dataSource = this.dataSource.filter((res, index) => { return index != this.dataSource.length - 1 })

            this.dataSource.forEach((item, index) => {
                item.number = index + 1;
            });
            this.$refs.plxTable.reloadData(this.dataSource)
            // 获取表格实例，里面可以得到列，表格数据等等
            console.log(this.$refs.plxTable.tableExample())
        }, 1000);
    },
    watch: {
        dataSourcePrice: {
            handler (newVal, oldVal) {
                newVal.forEach(item => {
                    if (item.price != null && item.price != 0) {
                        //计算金额
                        item.amount = (item.price * item.quantity).toFixed(2);
                    }
                })
            },
            deep: true,
        }
    },
    methods: {
        closePrice () {
            //关闭报价
            this.priceModal = false;
        },
        priceShow () {
            //报价弹窗
            this.priceModal = true;

            this.columnsPrice = this.columns;
            this.dataSourcePrice = _.cloneDeep(this.dataSource);

            this.$nextTick(() => {
                this.$refs.priceTable.reloadData(this.dataSourcePrice)
            })
        },
        getInOutRecord () {
            //获取出入库数量
            let data = this.orderData;
            let requestData = {
                sourceVoucherId: data.id,
                sourceVoucherType: this.sourceCode,
            }
            getInOutRecord(requestData).then(res => {
                if (res.code === 200) {
                    if (res.data.length > 0) {
                        this.inOutData = res.data;
                        let map = new Map();
                        this.inOutData.forEach(e => {
                            map.set(e.sourceDetailId, e)
                        });
                        console.log(map);
                        this.dataSource.forEach(item => {
                            if (map.get(item.id)) {
                                item.inNum = map.get(item.id).inNum;
                                item.outNum = map.get(item.id).outNum;
                            }

                        });
                        console.log(this.dataSource)
                    }
                }
            })
        },
        okPirce () {
            //确认报价
            console.log(this.dataSourcePrice);
            let data = _.cloneDeep(this.thisPageData);
            data.reviewerDate = null;
            data.createDate = null;
            data.detailList = [];
            data.orderDetailList = this.dataSourcePrice.filter(res => res.price != null && res.price != 0);
            setPrice(data).then(res => {
                if (res.code === 200) {
                    this.$message.success('报价成功');
                    this.priceModal = false;
                } else {
                    // this.$message.warning(res.message);
                }
            }).catch(err => {
                this.$message.warning(err)
            })
        },
        summaryMethod ({ columns, data }) {
            //合计
            const means = [];
            columns.forEach((column, columnIndex) => {
                if (columnIndex === 0) {
                    means.push('合计')
                } else {
                    const values = data.map(item => Number(item[column.property]));
                    // 合计
                    if (!values.every(value => isNaN(value))) {
                        if (column.property == 'number') {
                            means[columnIndex] = '';
                        } else {
                            if (this.totalYes.includes(column.property)) {
                                means[columnIndex] = values.reduce((prev, curr) => {
                                    const value = Number(curr);
                                    if (!isNaN(value)) {
                                        return prev + curr;
                                    } else {
                                        return prev;
                                    }
                                }, 0);
                                means[columnIndex] = means[columnIndex].toFixed(2);
                            }
                        }
                    } else {
                        means[columnIndex] = '';
                    }
                }
            })
            // 返回一个二维数组的表尾合计
            return [means]
        },
        // 更新合计
        updateFooterEvent (num) {
            // 这里执行了updateFooter，然后就自动会去执行你的summaryMethod合计方法啦
            this.$refs.plxTable.updateFooter()
        },
        // 添加插入行
        async insertEvent (row) {
            console.log(this.dataSource.length)
            let record = {
                number: this.dataSource.length + 1
            }
            this.dataSource.push({})
            // 加入行, 表示加入行的row对象，row为空则插入第一行，为-1插入最后一行
            let { row: newRow } = await this.$refs.plxTable.insertRow(record, row)
            // 激活单元格编辑
            await this.$refs.plxTable.setActiveRow(newRow)
        },
        priceData () {
            //报价
        },
        importData () {
            //导入数据
            this.$refs.importAreaRef.importAreaFile();
        },
        exportData () {
            //导出数据
            exportAreaData({ orderId: this.orderId }).then(response => {
                let url = window.URL.createObjectURL(
                    new Blob([response], { type: "application/vnd.ms-excel" })
                );
                let link = document.createElement("a");
                link.style.display = "none";
                link.href = url;
                link.setAttribute("download", "面积计算表.xls");
                document.body.appendChild(link);
                link.click();
            });
        },
        //新增预测单
        newForecast () {
            this.showModel = 'order';
            this.editMask = false;
            this.loading = false;
            this.voucherState = -1;
            this.sourceVoucherData = {};//清空来源数据
            this.initForm(1);

            setTimeout(() => {
                this.$refs.plxTable.reloadData(this.dataSource)
            }, 800)
        },
        //保存
        submit (requestData) {
            this.saveLoding = true;
            this.loading = true;
            save(requestData).then(response => {
                if (response.code === 200) {
                    this.$message.success('保存成功');
                    this.editMask = true;
                    this.isSaveRun = true;
                    this.saveLoding = false;
                    this.loading = false;

                    if (!this.orderId) {
                        this.getIdByData(); //获取最新一条数据
                    }
                } else {
                    this.$message.error(response.message);
                    this.isSaveRun = true;
                }
            }).catch((e) => {
                this.isSaveRun = true;
                this.saveLoding = false;
                this.loading = false;

            })
        },
        //审核
        auditClick (type) {
            let requestData = {
                id: this.orderId,
                status: type
            }
            examine(requestData).then((response) => {
                if (response.code === 200) {
                    const backData = response.data;
                    if (type == 1) {
                        this.$message.success('审核成功');
                        this.getIdByData();
                    }
                    if (type == 0) {
                        this.$message.success('弃审成功');
                        this.getIdByData();
                    }
                } else {
                    // this.$message.warning(response.message);
                }
            })
        },
        //删除
        remove (postData) {
            remove(postData).then(response => {
                if (response.code === 200) {
                    this.$message.success('删除成功');
                    this.orderId = '';
                    this.voucherState = 0;
                    this.getIdByData();//获取最新一条数据
                } else {
                    this.$message.error(response.message);
                }
            })
        },
        //获取单据编号
        getCode () {
            const { sourceCode } = this;
            getCode({ dataSource: sourceCode }).then((res) => {
                if (res.code == 200) {
                    console.log(res);
                    this.receiptNumber = res.message;
                    console.log(this.orderHeaderData)
                    for (let i = 0; i < this.orderHeaderData.length; i++) {
                        if (this.orderHeaderData[i].code == 'voucherCode') {
                            this.$set(this.orderHeaderData[i], 'onEdit', false)
                            this.$set(this.orderHeaderData[i], 'value', this.receiptNumber)
                        }
                    }
                } else {
                    // this.$message.warning(res.message);
                }
            });
        },
        backArea (data) {
            //导入返回的数据
            data.orderDetailList.forEach((item, index) => {
                item.number = index + 1;
            })
            this.dataSource = data.orderDetailList;

            this.orderHeaderData.forEach(item => {
                if (data[item.code] != null) {
                    if (item.code == 'projectId') {//项目id转name
                        item.value = data.projectName;
                        item.valueId = data.projectId;
                        item.valueName = data.projectName;
                    } else if (item.code == 'calculationUserId') { //员工id转name
                        item.value = data.calculationUserName;
                        item.valueId = data.calculationUserId;
                        item.valueName = data.calculationUserName;
                    } else {
                        item.value = data[item.code]
                    }
                }
            });
            this.$refs.plxTable.reloadData(this.dataSource)
            this.reload();
        },






        //关闭打印详情
        hideDetails () {
            this.printDetailsModal = false;
            this.selectedAgainRows = [];
            this.selectedAgainKeys = [];
        },
        onSelectAgainChange (key, row) {
            this.selectedAgainKeys = key;
            this.selectedAgainRows = row;
        },
        //生成条码
        generateByline () {
            if (this.selectionRow.length < 1) {
                this.$message.warning('请选择打印数据');
                return;
            }
            let detailIds = [];
            this.selectionRow.forEach(item => {
                detailIds.push(item.id)
            });

            let requestData = {
                detailIds: detailIds,
                sourceVoucherType: 'AreaCalculation',
            }
            getCodeListDetails(requestData).then(res => {
                if (res.code === 200) {
                    this.printDetailsModal = true;
                    this.dataSourceShowDetails = res.data;
                    console.log(this.dataSourceShowDetails);

                    this.dataSourceShowDetails.forEach(item => {
                        let ex = JSON.parse(item.extendJson);
                        Object.assign(item, ex);
                    });

                }
            })
        },
        //选中全部
        selectAll (selection) {
            this.selectionRow = selection;
        },
        //勾选
        selectTable (selection, row) {
            this.selectionRow = selection;
            console.log(selection);
        },
        //编号筛选
        filterAgeMethod ({ option, row }) {
            console.log(option, row)
            if (!row.no) {
                return '';
            } else {
                return row.no.indexOf(option.data) != -1;
            }
        },
        printPreviewLodop () {
            //打印预览Lodop
            if (this.selectedAgainKeys.length < 1) {
                this.$message.warning('请选择需要打印的数据');
                return;
            }
            LODOP = getLodop();
            LODOP.PRINT_INIT("");
            this.nihao(this.selectedAgainRows);
            LODOP.PREVIEW();
        },
        nihao (choiceData) {
            console.log(choiceData)
            for (let i = 0; i < choiceData.length; i++) {
                let data = choiceData[i];
                // let orderData = this.orderData;
                LODOP.NewPage();

                LODOP.SET_PRINT_MODE("PRINT_NOCOLLATE", 1);
                LODOP.ADD_PRINT_TABLE(13, -2, "100.28mm", "70.38mm", "<table  border=\"1\"  cellpadding=\"10\" style=\"font-family:幼圆;font-weight:bold;text-align:center;margin:0 auto;font-weight:bold;color:#000;border:1px solid #000;border-collapse: collapse;\">\r\n                    <tr>\r\n                        <td style=\"width:35px\"></td>\r\n                        <td style=\"width:220px\" colspan=\"2\">重庆新西亚铝业(集团)股份有限公司</td>\r\n                        <td style=\"width:35px\"></td>\r\n                    </tr>\r\n                    <tr>\r\n                        <td style=\"width:35px\">单号</td>\r\n                        <td></td>\r\n                        <td style=\"width:35px\">批次</td>\r\n                        <td></td>\r\n                    </tr>\r\n                    <tr>\r\n                        <td>项目</td>\r\n                        <td></td>\r\n                        <td>数量</td>\r\n                        <td></td>\r\n                    </tr>\r\n                    <tr>\r\n                        <td>编号</td>\r\n                        <td></td>\r\n                        <td rowspan=\"3\" colspan=\"2\"></td>\r\n                    </tr>\r\n                    <tr>\r\n                        <td>颜色</td>\r\n                        <td></td>\r\n                    </tr>\r\n                    <tr>\r\n                        <td>序号</td>\r\n                        <td></td>\r\n                    </tr>\r\n                </table>");
                LODOP.ADD_PRINT_TEXT(79, 78, 160, 27, data.voucherCode);//订单号
                LODOP.SET_PRINT_STYLEA(0, "FontName", "幼圆");
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.ADD_PRINT_TEXT(118, 78, 159, 27, data.projectCode);//项目
                LODOP.SET_PRINT_STYLEA(0, "FontName", "幼圆");
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.ADD_PRINT_TEXT(159, 78, 161, 27, data.no);//编号
                LODOP.SET_PRINT_STYLEA(0, "FontName", "幼圆");
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.ADD_PRINT_TEXT(79, 308, 58, 30, data.batch);//批次
                LODOP.SET_PRINT_STYLEA(0, "FontName", "幼圆");
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 14);
                LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.ADD_PRINT_BARCODE(160, 260, 132, 102, "QRCode", data.barCode);//二维码

                LODOP.SET_PRINT_STYLEA(0, "QRCodeErrorLevel", "H");
                LODOP.ADD_PRINT_TEXT(195, 78, 161, 27, data.colorName);//颜色
                LODOP.SET_PRINT_STYLEA(0, "FontName", "幼圆");
                if (data.colorName.length >= 14) {
                    LODOP.SET_PRINT_STYLEA(0, "FontSize", 10);
                } else if (data.colorName.length >= 18) {
                    LODOP.SET_PRINT_STYLEA(0, "FontSize", 8);
                } else {
                    LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                }
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.ADD_PRINT_TEXT(234, 78, 162, 27, data.lineNumber);//序号
                LODOP.SET_PRINT_STYLEA(0, "FontName", "幼圆");
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.ADD_PRINT_TEXT(118, 308, 57, 29, `${data.sort}/${data.quantity}`);//数量 第几张/总数
                LODOP.SET_PRINT_STYLEA(0, "FontName", "幼圆");
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
                LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
                LODOP.SET_PRINT_STYLEA(0, "Bold", 1);
                LODOP.ADD_PRINT_BARCODE(16, 308, 70, 64, "QRCode", data.barCode);//二维码
                LODOP.ADD_PRINT_BARCODE(16, 14, 70, 64, "QRCode", data.barCode);//二维码
            }
        },




    }
};
</script>
<style lang="less">
    @import '~@/style/purchase/voucher.less';
    .ux-table {
        .ant-input {
            border: 1px solid #000 !important;
            padding: 2px !important;
        }
        .elx-table .elx-cell {
            padding: 0 5px;
        }
    }
    .save-class {
        .ant-spin-dot {
            font-size: 60px;
        }
        .ant-spin-dot i {
            width: 30px;
            height: 30px;
            background: #fff;
        }
    }
</style>
